package com.huawei.lynnbit.tool.cocos.config.game;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

public enum PackageType {
    HAP("HAP"), APP("APP");
    private static Map<String, PackageType> namesMap = new HashMap<>();

    static {
        namesMap.put(HAP.name, HAP);
        namesMap.put(APP.name, APP);
    }

    private String name;

    PackageType(String name) {
        this.name = name;
    }

    @JsonCreator
    public static PackageType forName(String name) {
        return namesMap.get(name.toUpperCase(Locale.ROOT));
    }

    @JsonValue
    public String toName() {
        return name;
    }
}
